home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / C and C++ / POSIX / ThinkCPosix / chdir.c < prev    next >
Text File  |  1992-09-11  |  340b  |  24 lines

  1. /* $Id: $ */
  2.  
  3. #include "ThinkCPosix.h"
  4.  
  5. int
  6. chdir(path)
  7.     char *path;
  8. {
  9.     WDPBRec pb;
  10.     char name[FILENAME_MAX];
  11.     
  12.     strncpy(name, path, sizeof(name));
  13.     name[FILENAME_MAX-1]= '\0';
  14.     pb.ioNamePtr= (StringPtr) c2pstr(name);
  15.     pb.ioVRefNum= 0;
  16.     pb.ioWDDirID= 0;
  17.     if (PBHSetVol(&pb, FALSE) != noErr) {
  18.         errno= ENOENT;
  19.         return -1;
  20.     }
  21.     return 0;
  22. }
  23.  
  24.